package com.ele.Servlet;

import com.ele.Service.impl.BusinessServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 注册
 *
 */
@WebServlet("/businessRegist")
public class BusinessRegistServlet extends HttpServlet {
    //创建Service对象
    BusinessServiceImpl businessRegist = new BusinessServiceImpl();

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        String account = req.getParameter("account");
        String password = req.getParameter("password");
        String telephone = req.getParameter("telephone");
        String contact = req.getParameter("contact");

        // 不管前端有没有数据校验，后端都需要对数据做安全性的校验
        //需要校验，判断一下输入的内容：非空，合法字符，符合规范的内容

        Integer x=businessRegist.businessRegist(account,password,telephone,contact);
        resp.getWriter().write(x+"");

    }

}
